using System;
using System.Windows.Controls;
using System.Windows.Threading;
using SmartBoard.Server;

namespace SmartBoard
{
    public class TextBoxTextWriter : ITextWriter
    {
        public TextBox TextBox { get; private set; }

        public TextBoxTextWriter(TextBox textBox)
        {
            TextBox = textBox; 
        }

        public void WriteLine(string s)
        {
            TextBox.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) (() => TextBox.AppendText(s)));
        }
    }
}